﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>登陆</title>
<link rel="stylesheet" href="css/style.css" type="text/css" media="screen" />
<script src="js/jquery-1.5.2.min.js" type="text/javascript"></script>
<script language="javascript">
function doSubmit(){
	var code = $("#veryCode").val();
	var username = $("#username").val();
	var userpass = $("#userpass").val();
	
	if(username == ""){
		alert("请输入用户名");
		return;
	}
	
	if(userpass == ""){
		alert("请输入密码");
		return;
	}
	
	if ((code == "") || (code.length != 4)) {
		alert("请输入验证码");
		return;
	}
	
	$.post("main", $("#form1").serialize(), function(data) {
	    if (data.code == 0)
	    	window.top.location.href=data.message;
	    else if (data.code == 1)
	    	alert("用户名密码错误!");
	    else if (data.code == 2)
	    	alert("验证码错误");
	});
}

function img(id){
  	var imgSrc =$("#"+id);
   	var src = imgSrc.attr("src");   
  	imgSrc.attr("src","main?action=21&&time="+(new Date()).valueOf());  
 }
 
function callback(data){ 
    if(data.success=="false"){
    	img("needpicture");
    	alert("用户名密码错误!");
			$("#userpass").val("");
    }else{
    	window.location.href=data.url;
    }
}  

function keyUp(e) { 
　　var currKey=0,e=e||event;
　　currKey=e.keyCode||e.which||e.charCode;
		if(currKey==13){
			doSubmit();
		}
}

document.onkeyup = keyUp;


</script>
</head>

<body id="login">
		<div id="logo"></div>
		<div id="loginBox">
        
         <form id="form1">
         <div id="login_box">
         <div id="login_box_1">
                        <input type="hidden" id="action" name="action" value="18">
                <div id="loginname">
                    <label>用户名:</label><input id="username" name="username" value="" maxlength="6" onkeyup="value=value.replace(/[\W]/g,'') " onbeforepaste=
                    "clipboardData.setData('text',clipboardData.getData('text').replace(/[^\d]/g,''))" >  
               
                </div>
                <div id="loginpass">
                  <label>密&nbsp;&nbsp;&nbsp;码:</label><input type="password" id="userpass" name="userpass" maxlength="6" onkeyup="value=value.replace(/[\W]/g,'') " onbeforepaste=
                         "clipboardData.setData('text',clipboardData.getData('text').replace(/[^\d]/g,''))">
                         
                </div>
               
                <div id="logincode">
                    <label>验证码:</label><input id="veryCode" name="veryCode" type=text value="" maxLength=4 onkeyup="value=value.replace(/[\W]/g,'') " onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^\d]/g,''))">
                     <span><img id="needpicture" src="main?action=21" title="点击更换" onclick="img(this.id)"></img></span>
                </div>
                
           </div>
            
            <div id="login_box_2">
            <img src="images/login_bot.gif" width="176" height="176" onclick="doSubmit()" border="0" style="cursor:pointer"/>
           </div>
            <div id="logintype">
              <input type="radio" id="fruit1" name="fruit" value="1"/>残联入口
              <input type="radio" id="fruit2" name="fruit" value="2" checked="true"/>服务机构入口
           </div>
           </div>
            
          </form>
      </div>
</body>
</html>
